Average Error: 31.5 → 0.0
Time: 24.1s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.0270579233257835539971924987412421614863 \lor \neg \left(x \le 0.03007487465186483091561520097911852644756\right):\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\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.0270579233257835539971924987412421614863 \lor \neg \left(x \le 0.03007487465186483091561520097911852644756\right):\\
\;\;\;\;\frac{x}{x - \tan x} - \frac{\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 r20947 = x;
        double r20948 = sin(r20947);
        double r20949 = r20947 - r20948;
        double r20950 = tan(r20947);
        double r20951 = r20947 - r20950;
        double r20952 = r20949 / r20951;
        return r20952;
}

double f(double x) {
        double r20953 = x;
        double r20954 = -0.027057923325783554;
        bool r20955 = r20953 <= r20954;
        double r20956 = 0.03007487465186483;
        bool r20957 = r20953 <= r20956;
        double r20958 = !r20957;
        bool r20959 = r20955 || r20958;
        double r20960 = tan(r20953);
        double r20961 = r20953 - r20960;
        double r20962 = r20953 / r20961;
        double r20963 = sin(r20953);
        double r20964 = r20963 / r20961;
        double r20965 = r20962 - r20964;
        double r20966 = 0.225;
        double r20967 = 2.0;
        double r20968 = pow(r20953, r20967);
        double r20969 = r20966 * r20968;
        double r20970 = 0.009642857142857142;
        double r20971 = 4.0;
        double r20972 = pow(r20953, r20971);
        double r20973 = r20970 * r20972;
        double r20974 = 0.5;
        double r20975 = r20973 + r20974;
        double r20976 = r20969 - r20975;
        double r20977 = r20959 ? r20965 : r20976;
        return r20977;
}

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.027057923325783554 or 0.03007487465186483 < 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.027057923325783554 < x < 0.03007487465186483

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

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