Average Error: 31.0 → 0.0
Time: 18.0s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.03210368012546606364399082167437882162631 \lor \neg \left(x \le 0.02932571162275986881295963826232764404267\right):\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \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.03210368012546606364399082167437882162631 \lor \neg \left(x \le 0.02932571162275986881295963826232764404267\right):\\
\;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\

\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 r21001 = x;
        double r21002 = sin(r21001);
        double r21003 = r21001 - r21002;
        double r21004 = tan(r21001);
        double r21005 = r21001 - r21004;
        double r21006 = r21003 / r21005;
        return r21006;
}

double f(double x) {
        double r21007 = x;
        double r21008 = -0.032103680125466064;
        bool r21009 = r21007 <= r21008;
        double r21010 = 0.02932571162275987;
        bool r21011 = r21007 <= r21010;
        double r21012 = !r21011;
        bool r21013 = r21009 || r21012;
        double r21014 = tan(r21007);
        double r21015 = r21007 - r21014;
        double r21016 = r21007 / r21015;
        double r21017 = sin(r21007);
        double r21018 = r21017 / r21015;
        double r21019 = r21016 - r21018;
        double r21020 = 0.225;
        double r21021 = 2.0;
        double r21022 = pow(r21007, r21021);
        double r21023 = r21020 * r21022;
        double r21024 = 0.009642857142857142;
        double r21025 = 4.0;
        double r21026 = pow(r21007, r21025);
        double r21027 = r21024 * r21026;
        double r21028 = 0.5;
        double r21029 = r21027 + r21028;
        double r21030 = r21023 - r21029;
        double r21031 = r21013 ? r21019 : r21030;
        return r21031;
}

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.032103680125466064 or 0.02932571162275987 < 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}}\]

    if -0.032103680125466064 < x < 0.02932571162275987

    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)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -0.03210368012546606364399082167437882162631 \lor \neg \left(x \le 0.02932571162275986881295963826232764404267\right):\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \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 2019308 
(FPCore (x)
  :name "sintan (problem 3.4.5)"
  :precision binary64
  (/ (- x (sin x)) (- x (tan x))))