Average Error: 31.5 → 0.0
Time: 23.6s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.03014155718548879384077743281977745937183 \lor \neg \left(x \le 0.0345470449051646505411738985458214301616\right):\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{9}{40} \cdot {x}^{2} - \frac{27}{2800} \cdot {x}^{4}\right) - \frac{1}{2}\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -0.03014155718548879384077743281977745937183 \lor \neg \left(x \le 0.0345470449051646505411738985458214301616\right):\\
\;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\

\mathbf{else}:\\
\;\;\;\;\left(\frac{9}{40} \cdot {x}^{2} - \frac{27}{2800} \cdot {x}^{4}\right) - \frac{1}{2}\\

\end{array}
double f(double x) {
        double r20213 = x;
        double r20214 = sin(r20213);
        double r20215 = r20213 - r20214;
        double r20216 = tan(r20213);
        double r20217 = r20213 - r20216;
        double r20218 = r20215 / r20217;
        return r20218;
}

double f(double x) {
        double r20219 = x;
        double r20220 = -0.030141557185488794;
        bool r20221 = r20219 <= r20220;
        double r20222 = 0.03454704490516465;
        bool r20223 = r20219 <= r20222;
        double r20224 = !r20223;
        bool r20225 = r20221 || r20224;
        double r20226 = tan(r20219);
        double r20227 = r20219 - r20226;
        double r20228 = r20219 / r20227;
        double r20229 = sin(r20219);
        double r20230 = r20229 / r20227;
        double r20231 = r20228 - r20230;
        double r20232 = 0.225;
        double r20233 = 2.0;
        double r20234 = pow(r20219, r20233);
        double r20235 = r20232 * r20234;
        double r20236 = 0.009642857142857142;
        double r20237 = 4.0;
        double r20238 = pow(r20219, r20237);
        double r20239 = r20236 * r20238;
        double r20240 = r20235 - r20239;
        double r20241 = 0.5;
        double r20242 = r20240 - r20241;
        double r20243 = r20225 ? r20231 : r20242;
        return r20243;
}

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.030141557185488794 or 0.03454704490516465 < 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.030141557185488794 < x < 0.03454704490516465

    1. Initial program 63.1

      \[\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. Using strategy rm
    4. Applied associate--r+0.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -0.03014155718548879384077743281977745937183 \lor \neg \left(x \le 0.0345470449051646505411738985458214301616\right):\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{9}{40} \cdot {x}^{2} - \frac{27}{2800} \cdot {x}^{4}\right) - \frac{1}{2}\\ \end{array}\]

Reproduce

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