Average Error: 31.2 → 0.0
Time: 28.1s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.033668191967710336:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sqrt[3]{\sin x} \cdot \sqrt[3]{\sin x}}{\frac{x - \tan x}{\sqrt[3]{\sin x}}}\\ \mathbf{elif}\;x \le 0.033370679126448435:\\ \;\;\;\;\left(x \cdot x\right) \cdot \left(\frac{9}{40} - \left(x \cdot x\right) \cdot \frac{27}{2800}\right) - \frac{1}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{1}{x - \tan x} \cdot \sin x\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -0.033668191967710336:\\
\;\;\;\;\frac{x}{x - \tan x} - \frac{\sqrt[3]{\sin x} \cdot \sqrt[3]{\sin x}}{\frac{x - \tan x}{\sqrt[3]{\sin x}}}\\

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

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

\end{array}
double f(double x) {
        double r517068 = x;
        double r517069 = sin(r517068);
        double r517070 = r517068 - r517069;
        double r517071 = tan(r517068);
        double r517072 = r517068 - r517071;
        double r517073 = r517070 / r517072;
        return r517073;
}

double f(double x) {
        double r517074 = x;
        double r517075 = -0.033668191967710336;
        bool r517076 = r517074 <= r517075;
        double r517077 = tan(r517074);
        double r517078 = r517074 - r517077;
        double r517079 = r517074 / r517078;
        double r517080 = sin(r517074);
        double r517081 = cbrt(r517080);
        double r517082 = r517081 * r517081;
        double r517083 = r517078 / r517081;
        double r517084 = r517082 / r517083;
        double r517085 = r517079 - r517084;
        double r517086 = 0.033370679126448435;
        bool r517087 = r517074 <= r517086;
        double r517088 = r517074 * r517074;
        double r517089 = 0.225;
        double r517090 = 0.009642857142857142;
        double r517091 = r517088 * r517090;
        double r517092 = r517089 - r517091;
        double r517093 = r517088 * r517092;
        double r517094 = 0.5;
        double r517095 = r517093 - r517094;
        double r517096 = 1.0;
        double r517097 = r517096 / r517078;
        double r517098 = r517097 * r517080;
        double r517099 = r517079 - r517098;
        double r517100 = r517087 ? r517095 : r517099;
        double r517101 = r517076 ? r517085 : r517100;
        return r517101;
}

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.033668191967710336

    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}}\]
    4. Using strategy rm
    5. Applied add-cube-cbrt0.1

      \[\leadsto \frac{x}{x - \tan x} - \frac{\color{blue}{\left(\sqrt[3]{\sin x} \cdot \sqrt[3]{\sin x}\right) \cdot \sqrt[3]{\sin x}}}{x - \tan x}\]
    6. Applied associate-/l*0.1

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

    if -0.033668191967710336 < x < 0.033370679126448435

    1. Initial program 62.7

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied div-sub62.6

      \[\leadsto \color{blue}{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}}\]
    4. Using strategy rm
    5. Applied div-inv62.6

      \[\leadsto \frac{x}{x - \tan x} - \color{blue}{\sin x \cdot \frac{1}{x - \tan x}}\]
    6. 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)}\]
    7. Simplified0.0

      \[\leadsto \color{blue}{\left(x \cdot x\right) \cdot \left(\frac{9}{40} - \frac{27}{2800} \cdot \left(x \cdot x\right)\right) - \frac{1}{2}}\]

    if 0.033370679126448435 < x

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied div-sub0.0

      \[\leadsto \color{blue}{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}}\]
    4. Using strategy rm
    5. Applied div-inv0.0

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

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

Reproduce

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