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

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

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

\end{array}
double f(double x) {
        double r694820 = x;
        double r694821 = sin(r694820);
        double r694822 = r694820 - r694821;
        double r694823 = tan(r694820);
        double r694824 = r694820 - r694823;
        double r694825 = r694822 / r694824;
        return r694825;
}

double f(double x) {
        double r694826 = x;
        double r694827 = -0.026370186168873697;
        bool r694828 = r694826 <= r694827;
        double r694829 = sin(r694826);
        double r694830 = r694826 - r694829;
        double r694831 = tan(r694826);
        double r694832 = r694826 - r694831;
        double r694833 = r694830 / r694832;
        double r694834 = 0.02458873884700214;
        bool r694835 = r694826 <= r694834;
        double r694836 = 0.225;
        double r694837 = r694826 * r694836;
        double r694838 = r694837 * r694826;
        double r694839 = 0.009642857142857142;
        double r694840 = r694826 * r694826;
        double r694841 = r694840 * r694840;
        double r694842 = r694839 * r694841;
        double r694843 = r694838 - r694842;
        double r694844 = 0.5;
        double r694845 = r694843 - r694844;
        double r694846 = r694826 / r694832;
        double r694847 = r694829 / r694832;
        double r694848 = r694846 - r694847;
        double r694849 = r694835 ? r694845 : r694848;
        double r694850 = r694828 ? r694833 : r694849;
        return r694850;
}

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

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied flip3--41.7

      \[\leadsto \frac{\color{blue}{\frac{{x}^{3} - {\left(\sin x\right)}^{3}}{x \cdot x + \left(\sin x \cdot \sin x + x \cdot \sin x\right)}}}{x - \tan x}\]
    4. Simplified41.7

      \[\leadsto \frac{\frac{\color{blue}{\left(x \cdot x\right) \cdot x - \left(\sin x \cdot \sin x\right) \cdot \sin x}}{x \cdot x + \left(\sin x \cdot \sin x + x \cdot \sin x\right)}}{x - \tan x}\]
    5. Taylor expanded around inf 0.0

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

    if -0.026370186168873697 < x < 0.02458873884700214

    1. Initial program 63.2

      \[\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. Simplified0.0

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

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

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

Reproduce

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