Average Error: 31.3 → 0.0
Time: 8.6s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.0267757907687813344 \lor \neg \left(x \le 0.028698300516786159\right):\\ \;\;\;\;\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 -0.0267757907687813344 \lor \neg \left(x \le 0.028698300516786159\right):\\
\;\;\;\;\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 r7250 = x;
        double r7251 = sin(r7250);
        double r7252 = r7250 - r7251;
        double r7253 = tan(r7250);
        double r7254 = r7250 - r7253;
        double r7255 = r7252 / r7254;
        return r7255;
}

double f(double x) {
        double r7256 = x;
        double r7257 = -0.026775790768781334;
        bool r7258 = r7256 <= r7257;
        double r7259 = 0.02869830051678616;
        bool r7260 = r7256 <= r7259;
        double r7261 = !r7260;
        bool r7262 = r7258 || r7261;
        double r7263 = sin(r7256);
        double r7264 = r7256 - r7263;
        double r7265 = tan(r7256);
        double r7266 = r7256 - r7265;
        double r7267 = r7264 / r7266;
        double r7268 = 0.225;
        double r7269 = 2.0;
        double r7270 = pow(r7256, r7269);
        double r7271 = r7268 * r7270;
        double r7272 = 0.009642857142857142;
        double r7273 = 4.0;
        double r7274 = pow(r7256, r7273);
        double r7275 = r7272 * r7274;
        double r7276 = 0.5;
        double r7277 = r7275 + r7276;
        double r7278 = r7271 - r7277;
        double r7279 = r7262 ? r7267 : r7278;
        return r7279;
}

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.026775790768781334 or 0.02869830051678616 < x

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]

    if -0.026775790768781334 < x < 0.02869830051678616

    1. Initial program 63.3

      \[\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. Recombined 2 regimes into one program.
  4. Final simplification0.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -0.0267757907687813344 \lor \neg \left(x \le 0.028698300516786159\right):\\ \;\;\;\;\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 2020047 
(FPCore (x)
  :name "sintan (problem 3.4.5)"
  :precision binary64
  (/ (- x (sin x)) (- x (tan x))))