Average Error: 31.2 → 0.0
Time: 49.4s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.029021700279035747:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 0.029500701526914974:\\ \;\;\;\;\left(x \cdot x\right) \cdot \left(\frac{9}{40} - \left(x \cdot x\right) \cdot \frac{27}{2800}\right) - \frac{1}{2}\\ \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.029021700279035747:\\
\;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\

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

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

\end{array}
double f(double x) {
        double r750091 = x;
        double r750092 = sin(r750091);
        double r750093 = r750091 - r750092;
        double r750094 = tan(r750091);
        double r750095 = r750091 - r750094;
        double r750096 = r750093 / r750095;
        return r750096;
}

double f(double x) {
        double r750097 = x;
        double r750098 = -0.029021700279035747;
        bool r750099 = r750097 <= r750098;
        double r750100 = tan(r750097);
        double r750101 = r750097 - r750100;
        double r750102 = r750097 / r750101;
        double r750103 = sin(r750097);
        double r750104 = r750103 / r750101;
        double r750105 = r750102 - r750104;
        double r750106 = 0.029500701526914974;
        bool r750107 = r750097 <= r750106;
        double r750108 = r750097 * r750097;
        double r750109 = 0.225;
        double r750110 = 0.009642857142857142;
        double r750111 = r750108 * r750110;
        double r750112 = r750109 - r750111;
        double r750113 = r750108 * r750112;
        double r750114 = 0.5;
        double r750115 = r750113 - r750114;
        double r750116 = r750107 ? r750115 : r750105;
        double r750117 = r750099 ? r750105 : r750116;
        return r750117;
}

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.029021700279035747 or 0.029500701526914974 < x

    1. Initial program 0.1

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

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

    if -0.029021700279035747 < x < 0.029500701526914974

    1. Initial program 62.9

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

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

Reproduce

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