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

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

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

\end{array}
double f(double x) {
        double r749906 = x;
        double r749907 = sin(r749906);
        double r749908 = r749906 - r749907;
        double r749909 = tan(r749906);
        double r749910 = r749906 - r749909;
        double r749911 = r749908 / r749910;
        return r749911;
}

double f(double x) {
        double r749912 = x;
        double r749913 = -0.030916815840808982;
        bool r749914 = r749912 <= r749913;
        double r749915 = tan(r749912);
        double r749916 = r749912 - r749915;
        double r749917 = r749912 / r749916;
        double r749918 = sin(r749912);
        double r749919 = r749918 / r749916;
        double r749920 = r749917 - r749919;
        double r749921 = exp(r749920);
        double r749922 = log(r749921);
        double r749923 = 0.032993602201721775;
        bool r749924 = r749912 <= r749923;
        double r749925 = 0.225;
        double r749926 = r749925 * r749912;
        double r749927 = r749912 * r749926;
        double r749928 = r749912 * r749912;
        double r749929 = 0.009642857142857142;
        double r749930 = r749928 * r749929;
        double r749931 = r749928 * r749930;
        double r749932 = 0.5;
        double r749933 = r749931 + r749932;
        double r749934 = r749927 - r749933;
        double r749935 = r749924 ? r749934 : r749922;
        double r749936 = r749914 ? r749922 : r749935;
        return r749936;
}

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.030916815840808982 or 0.032993602201721775 < 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}}\]
    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.1

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

    if -0.030916815840808982 < x < 0.032993602201721775

    1. Initial program 62.8

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

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

      \[\leadsto \color{blue}{\left(x \cdot \frac{9}{40}\right) \cdot x - \left(\frac{1}{2} + \left(\frac{27}{2800} \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.0

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

Reproduce

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