Average Error: 30.9 → 0.0
Time: 28.9s
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(\left(x \cdot x\right) \cdot \frac{9}{40} - \frac{1}{2}\right) - \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \frac{27}{2800}\\ \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(\left(x \cdot x\right) \cdot \frac{9}{40} - \frac{1}{2}\right) - \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \frac{27}{2800}\\

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

\end{array}
double f(double x) {
        double r407152 = x;
        double r407153 = sin(r407152);
        double r407154 = r407152 - r407153;
        double r407155 = tan(r407152);
        double r407156 = r407152 - r407155;
        double r407157 = r407154 / r407156;
        return r407157;
}

double f(double x) {
        double r407158 = x;
        double r407159 = -0.025621427997812182;
        bool r407160 = r407158 <= r407159;
        double r407161 = tan(r407158);
        double r407162 = r407158 - r407161;
        double r407163 = r407158 / r407162;
        double r407164 = sin(r407158);
        double r407165 = r407164 / r407162;
        double r407166 = r407163 - r407165;
        double r407167 = 0.03210649578243009;
        bool r407168 = r407158 <= r407167;
        double r407169 = r407158 * r407158;
        double r407170 = 0.225;
        double r407171 = r407169 * r407170;
        double r407172 = 0.5;
        double r407173 = r407171 - r407172;
        double r407174 = r407169 * r407169;
        double r407175 = 0.009642857142857142;
        double r407176 = r407174 * r407175;
        double r407177 = r407173 - r407176;
        double r407178 = r407168 ? r407177 : r407166;
        double r407179 = r407160 ? r407166 : r407178;
        return r407179;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

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. 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(\left(x \cdot x\right) \cdot \frac{9}{40} - \frac{1}{2}\right) - \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \frac{27}{2800}}\]
  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(\left(x \cdot x\right) \cdot \frac{9}{40} - \frac{1}{2}\right) - \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \frac{27}{2800}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \end{array}\]

Reproduce

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