Average Error: 31.7 → 0.1
Time: 25.8s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -1.561812654254879140225398259644862264395 \lor \neg \left(x \le 1.586202501676462706114989487105049192905\right):\\ \;\;\;\;\sqrt{\frac{x - \sin x}{x - \tan x}} \cdot \sqrt{\frac{x - \sin x}{x - \tan x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{9}{40} \cdot {x}^{2} - \left(\frac{27}{2800} \cdot {x}^{4} + \frac{1}{2}\right)\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -1.561812654254879140225398259644862264395 \lor \neg \left(x \le 1.586202501676462706114989487105049192905\right):\\
\;\;\;\;\sqrt{\frac{x - \sin x}{x - \tan x}} \cdot \sqrt{\frac{x - \sin x}{x - \tan x}}\\

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

\end{array}
double f(double x) {
        double r19993 = x;
        double r19994 = sin(r19993);
        double r19995 = r19993 - r19994;
        double r19996 = tan(r19993);
        double r19997 = r19993 - r19996;
        double r19998 = r19995 / r19997;
        return r19998;
}

double f(double x) {
        double r19999 = x;
        double r20000 = -1.5618126542548791;
        bool r20001 = r19999 <= r20000;
        double r20002 = 1.5862025016764627;
        bool r20003 = r19999 <= r20002;
        double r20004 = !r20003;
        bool r20005 = r20001 || r20004;
        double r20006 = sin(r19999);
        double r20007 = r19999 - r20006;
        double r20008 = tan(r19999);
        double r20009 = r19999 - r20008;
        double r20010 = r20007 / r20009;
        double r20011 = sqrt(r20010);
        double r20012 = r20011 * r20011;
        double r20013 = 0.225;
        double r20014 = 2.0;
        double r20015 = pow(r19999, r20014);
        double r20016 = r20013 * r20015;
        double r20017 = 0.009642857142857142;
        double r20018 = 4.0;
        double r20019 = pow(r19999, r20018);
        double r20020 = r20017 * r20019;
        double r20021 = 0.5;
        double r20022 = r20020 + r20021;
        double r20023 = r20016 - r20022;
        double r20024 = r20005 ? r20012 : r20023;
        return r20024;
}

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 < -1.5618126542548791 or 1.5862025016764627 < x

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt0.0

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

    if -1.5618126542548791 < x < 1.5862025016764627

    1. Initial program 62.7

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Taylor expanded around 0 0.2

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

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

Reproduce

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