Average Error: 31.4 → 0.0
Time: 15.7s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.029158977316943849:\\ \;\;\;\;\log \left(e^{\frac{\frac{{\left(\frac{x}{x - \tan x}\right)}^{6} - {\left(\frac{\sin x}{x - \tan x}\right)}^{6}}{{\left(\frac{x}{x - \tan x}\right)}^{3} + {\left(\frac{\sin x}{x - \tan x}\right)}^{3}}}{\frac{x}{x - \tan x} \cdot \frac{x}{x - \tan x} + \frac{\sin x}{x - \tan x} \cdot \left(\frac{x}{x - \tan x} + \frac{\sin x}{x - \tan x}\right)}}\right)\\ \mathbf{elif}\;x \le 0.028578832745905277:\\ \;\;\;\;\frac{9}{40} \cdot {x}^{2} - \left(\frac{27}{2800} \cdot {x}^{4} + \frac{1}{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\log \left(e^{\frac{{\left(\frac{x}{x - \tan x}\right)}^{3} - {\left(\frac{\sin x}{x - \tan x}\right)}^{3}}{\frac{x}{x - \tan x} \cdot \frac{x}{x - \tan x} + \frac{\sin x}{x - \tan x} \cdot \left(\frac{x}{x - \tan x} + \frac{\sin x}{x - \tan x}\right)}}\right)\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -0.029158977316943849:\\
\;\;\;\;\log \left(e^{\frac{\frac{{\left(\frac{x}{x - \tan x}\right)}^{6} - {\left(\frac{\sin x}{x - \tan x}\right)}^{6}}{{\left(\frac{x}{x - \tan x}\right)}^{3} + {\left(\frac{\sin x}{x - \tan x}\right)}^{3}}}{\frac{x}{x - \tan x} \cdot \frac{x}{x - \tan x} + \frac{\sin x}{x - \tan x} \cdot \left(\frac{x}{x - \tan x} + \frac{\sin x}{x - \tan x}\right)}}\right)\\

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

\mathbf{else}:\\
\;\;\;\;\log \left(e^{\frac{{\left(\frac{x}{x - \tan x}\right)}^{3} - {\left(\frac{\sin x}{x - \tan x}\right)}^{3}}{\frac{x}{x - \tan x} \cdot \frac{x}{x - \tan x} + \frac{\sin x}{x - \tan x} \cdot \left(\frac{x}{x - \tan x} + \frac{\sin x}{x - \tan x}\right)}}\right)\\

\end{array}
double f(double x) {
        double r18039 = x;
        double r18040 = sin(r18039);
        double r18041 = r18039 - r18040;
        double r18042 = tan(r18039);
        double r18043 = r18039 - r18042;
        double r18044 = r18041 / r18043;
        return r18044;
}

double f(double x) {
        double r18045 = x;
        double r18046 = -0.02915897731694385;
        bool r18047 = r18045 <= r18046;
        double r18048 = tan(r18045);
        double r18049 = r18045 - r18048;
        double r18050 = r18045 / r18049;
        double r18051 = 6.0;
        double r18052 = pow(r18050, r18051);
        double r18053 = sin(r18045);
        double r18054 = r18053 / r18049;
        double r18055 = pow(r18054, r18051);
        double r18056 = r18052 - r18055;
        double r18057 = 3.0;
        double r18058 = pow(r18050, r18057);
        double r18059 = pow(r18054, r18057);
        double r18060 = r18058 + r18059;
        double r18061 = r18056 / r18060;
        double r18062 = r18050 * r18050;
        double r18063 = r18050 + r18054;
        double r18064 = r18054 * r18063;
        double r18065 = r18062 + r18064;
        double r18066 = r18061 / r18065;
        double r18067 = exp(r18066);
        double r18068 = log(r18067);
        double r18069 = 0.028578832745905277;
        bool r18070 = r18045 <= r18069;
        double r18071 = 0.225;
        double r18072 = 2.0;
        double r18073 = pow(r18045, r18072);
        double r18074 = r18071 * r18073;
        double r18075 = 0.009642857142857142;
        double r18076 = 4.0;
        double r18077 = pow(r18045, r18076);
        double r18078 = r18075 * r18077;
        double r18079 = 0.5;
        double r18080 = r18078 + r18079;
        double r18081 = r18074 - r18080;
        double r18082 = r18058 - r18059;
        double r18083 = r18082 / r18065;
        double r18084 = exp(r18083);
        double r18085 = log(r18084);
        double r18086 = r18070 ? r18081 : r18085;
        double r18087 = r18047 ? r18068 : r18086;
        return r18087;
}

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

    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}}\]
    4. Using strategy rm
    5. Applied add-log-exp0.2

      \[\leadsto \frac{x}{x - \tan x} - \color{blue}{\log \left(e^{\frac{\sin x}{x - \tan x}}\right)}\]
    6. Applied add-log-exp0.2

      \[\leadsto \color{blue}{\log \left(e^{\frac{x}{x - \tan x}}\right)} - \log \left(e^{\frac{\sin x}{x - \tan x}}\right)\]
    7. Applied diff-log0.2

      \[\leadsto \color{blue}{\log \left(\frac{e^{\frac{x}{x - \tan x}}}{e^{\frac{\sin x}{x - \tan x}}}\right)}\]
    8. Simplified0.1

      \[\leadsto \log \color{blue}{\left(e^{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}}\right)}\]
    9. Using strategy rm
    10. Applied flip3--0.1

      \[\leadsto \log \left(e^{\color{blue}{\frac{{\left(\frac{x}{x - \tan x}\right)}^{3} - {\left(\frac{\sin x}{x - \tan x}\right)}^{3}}{\frac{x}{x - \tan x} \cdot \frac{x}{x - \tan x} + \left(\frac{\sin x}{x - \tan x} \cdot \frac{\sin x}{x - \tan x} + \frac{x}{x - \tan x} \cdot \frac{\sin x}{x - \tan x}\right)}}}\right)\]
    11. Simplified0.1

      \[\leadsto \log \left(e^{\frac{{\left(\frac{x}{x - \tan x}\right)}^{3} - {\left(\frac{\sin x}{x - \tan x}\right)}^{3}}{\color{blue}{\frac{x}{x - \tan x} \cdot \frac{x}{x - \tan x} + \frac{\sin x}{x - \tan x} \cdot \left(\frac{x}{x - \tan x} + \frac{\sin x}{x - \tan x}\right)}}}\right)\]
    12. Using strategy rm
    13. Applied flip--0.1

      \[\leadsto \log \left(e^{\frac{\color{blue}{\frac{{\left(\frac{x}{x - \tan x}\right)}^{3} \cdot {\left(\frac{x}{x - \tan x}\right)}^{3} - {\left(\frac{\sin x}{x - \tan x}\right)}^{3} \cdot {\left(\frac{\sin x}{x - \tan x}\right)}^{3}}{{\left(\frac{x}{x - \tan x}\right)}^{3} + {\left(\frac{\sin x}{x - \tan x}\right)}^{3}}}}{\frac{x}{x - \tan x} \cdot \frac{x}{x - \tan x} + \frac{\sin x}{x - \tan x} \cdot \left(\frac{x}{x - \tan x} + \frac{\sin x}{x - \tan x}\right)}}\right)\]
    14. Simplified0.1

      \[\leadsto \log \left(e^{\frac{\frac{\color{blue}{{\left(\frac{x}{x - \tan x}\right)}^{6} - {\left(\frac{\sin x}{x - \tan x}\right)}^{6}}}{{\left(\frac{x}{x - \tan x}\right)}^{3} + {\left(\frac{\sin x}{x - \tan x}\right)}^{3}}}{\frac{x}{x - \tan x} \cdot \frac{x}{x - \tan x} + \frac{\sin x}{x - \tan x} \cdot \left(\frac{x}{x - \tan x} + \frac{\sin x}{x - \tan x}\right)}}\right)\]

    if -0.02915897731694385 < x < 0.028578832745905277

    1. Initial program 63.1

      \[\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.028578832745905277 < 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 add-log-exp0.1

      \[\leadsto \frac{x}{x - \tan x} - \color{blue}{\log \left(e^{\frac{\sin x}{x - \tan x}}\right)}\]
    6. Applied add-log-exp0.1

      \[\leadsto \color{blue}{\log \left(e^{\frac{x}{x - \tan x}}\right)} - \log \left(e^{\frac{\sin x}{x - \tan x}}\right)\]
    7. Applied diff-log0.1

      \[\leadsto \color{blue}{\log \left(\frac{e^{\frac{x}{x - \tan x}}}{e^{\frac{\sin x}{x - \tan x}}}\right)}\]
    8. Simplified0.0

      \[\leadsto \log \color{blue}{\left(e^{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}}\right)}\]
    9. Using strategy rm
    10. Applied flip3--0.0

      \[\leadsto \log \left(e^{\color{blue}{\frac{{\left(\frac{x}{x - \tan x}\right)}^{3} - {\left(\frac{\sin x}{x - \tan x}\right)}^{3}}{\frac{x}{x - \tan x} \cdot \frac{x}{x - \tan x} + \left(\frac{\sin x}{x - \tan x} \cdot \frac{\sin x}{x - \tan x} + \frac{x}{x - \tan x} \cdot \frac{\sin x}{x - \tan x}\right)}}}\right)\]
    11. Simplified0.0

      \[\leadsto \log \left(e^{\frac{{\left(\frac{x}{x - \tan x}\right)}^{3} - {\left(\frac{\sin x}{x - \tan x}\right)}^{3}}{\color{blue}{\frac{x}{x - \tan x} \cdot \frac{x}{x - \tan x} + \frac{\sin x}{x - \tan x} \cdot \left(\frac{x}{x - \tan x} + \frac{\sin x}{x - \tan x}\right)}}}\right)\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.0

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

Reproduce

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