Average Error: 31.5 → 0.0
Time: 9.9s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.0280088682792076112:\\ \;\;\;\;\sqrt[3]{{\left(\frac{x - \sin x}{x - \tan x}\right)}^{3}}\\ \mathbf{elif}\;x \le 0.029271144045934241:\\ \;\;\;\;\frac{9}{40} \cdot {x}^{2} - \left(\frac{27}{2800} \cdot {x}^{4} + \frac{1}{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -0.0280088682792076112:\\
\;\;\;\;\sqrt[3]{{\left(\frac{x - \sin x}{x - \tan x}\right)}^{3}}\\

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

\mathbf{else}:\\
\;\;\;\;\frac{x - \sin x}{x - \tan x}\\

\end{array}
double f(double x) {
        double r14887 = x;
        double r14888 = sin(r14887);
        double r14889 = r14887 - r14888;
        double r14890 = tan(r14887);
        double r14891 = r14887 - r14890;
        double r14892 = r14889 / r14891;
        return r14892;
}

double f(double x) {
        double r14893 = x;
        double r14894 = -0.02800886827920761;
        bool r14895 = r14893 <= r14894;
        double r14896 = sin(r14893);
        double r14897 = r14893 - r14896;
        double r14898 = tan(r14893);
        double r14899 = r14893 - r14898;
        double r14900 = r14897 / r14899;
        double r14901 = 3.0;
        double r14902 = pow(r14900, r14901);
        double r14903 = cbrt(r14902);
        double r14904 = 0.02927114404593424;
        bool r14905 = r14893 <= r14904;
        double r14906 = 0.225;
        double r14907 = 2.0;
        double r14908 = pow(r14893, r14907);
        double r14909 = r14906 * r14908;
        double r14910 = 0.009642857142857142;
        double r14911 = 4.0;
        double r14912 = pow(r14893, r14911);
        double r14913 = r14910 * r14912;
        double r14914 = 0.5;
        double r14915 = r14913 + r14914;
        double r14916 = r14909 - r14915;
        double r14917 = r14905 ? r14916 : r14900;
        double r14918 = r14895 ? r14903 : r14917;
        return r14918;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if x < -0.02800886827920761

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied add-cbrt-cube42.6

      \[\leadsto \frac{x - \sin x}{\color{blue}{\sqrt[3]{\left(\left(x - \tan x\right) \cdot \left(x - \tan x\right)\right) \cdot \left(x - \tan x\right)}}}\]
    4. Applied add-cbrt-cube43.9

      \[\leadsto \frac{\color{blue}{\sqrt[3]{\left(\left(x - \sin x\right) \cdot \left(x - \sin x\right)\right) \cdot \left(x - \sin x\right)}}}{\sqrt[3]{\left(\left(x - \tan x\right) \cdot \left(x - \tan x\right)\right) \cdot \left(x - \tan x\right)}}\]
    5. Applied cbrt-undiv43.9

      \[\leadsto \color{blue}{\sqrt[3]{\frac{\left(\left(x - \sin x\right) \cdot \left(x - \sin x\right)\right) \cdot \left(x - \sin x\right)}{\left(\left(x - \tan x\right) \cdot \left(x - \tan x\right)\right) \cdot \left(x - \tan x\right)}}}\]
    6. Simplified0.1

      \[\leadsto \sqrt[3]{\color{blue}{{\left(\frac{x - \sin x}{x - \tan x}\right)}^{3}}}\]

    if -0.02800886827920761 < x < 0.02927114404593424

    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)}\]

    if 0.02927114404593424 < x

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.0

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

Reproduce

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