Average Error: 31.8 → 0.0
Time: 18.7s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le \frac{-1015321400706025}{36028797018963968} \lor \neg \left(x \le \frac{7717059153152793}{288230376151711744}\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 \frac{-1015321400706025}{36028797018963968} \lor \neg \left(x \le \frac{7717059153152793}{288230376151711744}\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 r20228 = x;
        double r20229 = sin(r20228);
        double r20230 = r20228 - r20229;
        double r20231 = tan(r20228);
        double r20232 = r20228 - r20231;
        double r20233 = r20230 / r20232;
        return r20233;
}

double f(double x) {
        double r20234 = x;
        double r20235 = -1015321400706025.0;
        double r20236 = 3.602879701896397e+16;
        double r20237 = r20235 / r20236;
        bool r20238 = r20234 <= r20237;
        double r20239 = 7717059153152793.0;
        double r20240 = 2.8823037615171174e+17;
        double r20241 = r20239 / r20240;
        bool r20242 = r20234 <= r20241;
        double r20243 = !r20242;
        bool r20244 = r20238 || r20243;
        double r20245 = tan(r20234);
        double r20246 = r20234 - r20245;
        double r20247 = r20234 / r20246;
        double r20248 = sin(r20234);
        double r20249 = r20248 / r20246;
        double r20250 = r20247 - r20249;
        double r20251 = 0.225;
        double r20252 = 2.0;
        double r20253 = pow(r20234, r20252);
        double r20254 = r20251 * r20253;
        double r20255 = 0.009642857142857142;
        double r20256 = 4.0;
        double r20257 = pow(r20234, r20256);
        double r20258 = r20255 * r20257;
        double r20259 = r20254 - r20258;
        double r20260 = 0.5;
        double r20261 = r20259 - r20260;
        double r20262 = r20244 ? r20250 : r20261;
        return r20262;
}

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.02818082991146234 or 0.026773927356951697 < x

    1. Initial program 0.0

      \[\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.02818082991146234 < x < 0.026773927356951697

    1. Initial program 63.2

      \[\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 \frac{-1015321400706025}{36028797018963968} \lor \neg \left(x \le \frac{7717059153152793}{288230376151711744}\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 2019304 
(FPCore (x)
  :name "sintan (problem 3.4.5)"
  :precision binary64
  (/ (- x (sin x)) (- x (tan x))))