Average Error: 31.6 → 0.0
Time: 12.2s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.0258291753859107888 \lor \neg \left(x \le 0.0284410596258715502\right):\\ \;\;\;\;\log \left(e^{\frac{x - \sin x}{x - \tan x}}\right)\\ \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.0258291753859107888 \lor \neg \left(x \le 0.0284410596258715502\right):\\
\;\;\;\;\log \left(e^{\frac{x - \sin x}{x - \tan x}}\right)\\

\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 r9014 = x;
        double r9015 = sin(r9014);
        double r9016 = r9014 - r9015;
        double r9017 = tan(r9014);
        double r9018 = r9014 - r9017;
        double r9019 = r9016 / r9018;
        return r9019;
}

double f(double x) {
        double r9020 = x;
        double r9021 = -0.02582917538591079;
        bool r9022 = r9020 <= r9021;
        double r9023 = 0.02844105962587155;
        bool r9024 = r9020 <= r9023;
        double r9025 = !r9024;
        bool r9026 = r9022 || r9025;
        double r9027 = sin(r9020);
        double r9028 = r9020 - r9027;
        double r9029 = tan(r9020);
        double r9030 = r9020 - r9029;
        double r9031 = r9028 / r9030;
        double r9032 = exp(r9031);
        double r9033 = log(r9032);
        double r9034 = 0.225;
        double r9035 = 2.0;
        double r9036 = pow(r9020, r9035);
        double r9037 = r9034 * r9036;
        double r9038 = 0.009642857142857142;
        double r9039 = 4.0;
        double r9040 = pow(r9020, r9039);
        double r9041 = r9038 * r9040;
        double r9042 = 0.5;
        double r9043 = r9041 + r9042;
        double r9044 = r9037 - r9043;
        double r9045 = r9026 ? r9033 : r9044;
        return r9045;
}

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.02582917538591079 or 0.02844105962587155 < x

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied add-log-exp0.0

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

    if -0.02582917538591079 < x < 0.02844105962587155

    1. Initial program 63.0

      \[\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.0258291753859107888 \lor \neg \left(x \le 0.0284410596258715502\right):\\ \;\;\;\;\log \left(e^{\frac{x - \sin x}{x - \tan x}}\right)\\ \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 2020046 
(FPCore (x)
  :name "sintan (problem 3.4.5)"
  :precision binary64
  (/ (- x (sin x)) (- x (tan x))))