Average Error: 31.2 → 0.1
Time: 34.7s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -4.638405512419418:\\ \;\;\;\;e^{\log \left(\frac{x - \sin x}{x - \tan x}\right)}\\ \mathbf{elif}\;x \le 1.5588973207876802:\\ \;\;\;\;\left(x \cdot x\right) \cdot \left(\frac{9}{40} - \left(x \cdot x\right) \cdot \frac{27}{2800}\right) - \frac{1}{2}\\ \mathbf{else}:\\ \;\;\;\;e^{\log \left(\frac{x - \sin x}{x - \tan x}\right)}\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -4.638405512419418:\\
\;\;\;\;e^{\log \left(\frac{x - \sin x}{x - \tan x}\right)}\\

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

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

\end{array}
double f(double x) {
        double r712716 = x;
        double r712717 = sin(r712716);
        double r712718 = r712716 - r712717;
        double r712719 = tan(r712716);
        double r712720 = r712716 - r712719;
        double r712721 = r712718 / r712720;
        return r712721;
}

double f(double x) {
        double r712722 = x;
        double r712723 = -4.638405512419418;
        bool r712724 = r712722 <= r712723;
        double r712725 = sin(r712722);
        double r712726 = r712722 - r712725;
        double r712727 = tan(r712722);
        double r712728 = r712722 - r712727;
        double r712729 = r712726 / r712728;
        double r712730 = log(r712729);
        double r712731 = exp(r712730);
        double r712732 = 1.5588973207876802;
        bool r712733 = r712722 <= r712732;
        double r712734 = r712722 * r712722;
        double r712735 = 0.225;
        double r712736 = 0.009642857142857142;
        double r712737 = r712734 * r712736;
        double r712738 = r712735 - r712737;
        double r712739 = r712734 * r712738;
        double r712740 = 0.5;
        double r712741 = r712739 - r712740;
        double r712742 = r712733 ? r712741 : r712731;
        double r712743 = r712724 ? r712731 : r712742;
        return r712743;
}

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 < -4.638405512419418 or 1.5588973207876802 < x

    1. Initial program 0.0

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

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

    if -4.638405512419418 < x < 1.5588973207876802

    1. Initial program 62.3

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Taylor expanded around 0 0.2

      \[\leadsto \color{blue}{\frac{9}{40} \cdot {x}^{2} - \left(\frac{27}{2800} \cdot {x}^{4} + \frac{1}{2}\right)}\]
    3. Simplified0.2

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

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

Reproduce

herbie shell --seed 2019138 +o rules:numerics
(FPCore (x)
  :name "sintan (problem 3.4.5)"
  (/ (- x (sin x)) (- x (tan x))))