Average Error: 31.4 → 0.0
Time: 45.4s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.0343675887053717:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 0.03216989433394439:\\ \;\;\;\;\left(\left(x \cdot x\right) \cdot \frac{9}{40} - \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.0343675887053717:\\
\;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\

\mathbf{elif}\;x \le 0.03216989433394439:\\
\;\;\;\;\left(\left(x \cdot x\right) \cdot \frac{9}{40} - \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 r1018628 = x;
        double r1018629 = sin(r1018628);
        double r1018630 = r1018628 - r1018629;
        double r1018631 = tan(r1018628);
        double r1018632 = r1018628 - r1018631;
        double r1018633 = r1018630 / r1018632;
        return r1018633;
}

double f(double x) {
        double r1018634 = x;
        double r1018635 = -0.0343675887053717;
        bool r1018636 = r1018634 <= r1018635;
        double r1018637 = tan(r1018634);
        double r1018638 = r1018634 - r1018637;
        double r1018639 = r1018634 / r1018638;
        double r1018640 = sin(r1018634);
        double r1018641 = r1018640 / r1018638;
        double r1018642 = r1018639 - r1018641;
        double r1018643 = 0.03216989433394439;
        bool r1018644 = r1018634 <= r1018643;
        double r1018645 = r1018634 * r1018634;
        double r1018646 = 0.225;
        double r1018647 = r1018645 * r1018646;
        double r1018648 = 0.009642857142857142;
        double r1018649 = r1018645 * r1018645;
        double r1018650 = r1018648 * r1018649;
        double r1018651 = r1018647 - r1018650;
        double r1018652 = 0.5;
        double r1018653 = r1018651 - r1018652;
        double r1018654 = r1018644 ? r1018653 : r1018642;
        double r1018655 = r1018636 ? r1018642 : r1018654;
        return r1018655;
}

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.0343675887053717 or 0.03216989433394439 < 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.0343675887053717 < x < 0.03216989433394439

    1. Initial program 62.7

      \[\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 x\right) \cdot \frac{9}{40} - \left(\left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \frac{27}{2800} + \frac{1}{2}\right)}\]
    4. Using strategy rm
    5. Applied associate--r+0.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -0.0343675887053717:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 0.03216989433394439:\\ \;\;\;\;\left(\left(x \cdot x\right) \cdot \frac{9}{40} - \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 2019112 
(FPCore (x)
  :name "sintan (problem 3.4.5)"
  (/ (- x (sin x)) (- x (tan x))))