Average Error: 30.9 → 0.0
Time: 25.7s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.028213729881585915:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 0.031240215431948184:\\ \;\;\;\;\left(\left(x \cdot x\right) \cdot \frac{9}{40} - \frac{1}{2}\right) - \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \frac{27}{2800}\\ \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.028213729881585915:\\
\;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\

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

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

\end{array}
double f(double x) {
        double r329225 = x;
        double r329226 = sin(r329225);
        double r329227 = r329225 - r329226;
        double r329228 = tan(r329225);
        double r329229 = r329225 - r329228;
        double r329230 = r329227 / r329229;
        return r329230;
}

double f(double x) {
        double r329231 = x;
        double r329232 = -0.028213729881585915;
        bool r329233 = r329231 <= r329232;
        double r329234 = tan(r329231);
        double r329235 = r329231 - r329234;
        double r329236 = r329231 / r329235;
        double r329237 = sin(r329231);
        double r329238 = r329237 / r329235;
        double r329239 = r329236 - r329238;
        double r329240 = 0.031240215431948184;
        bool r329241 = r329231 <= r329240;
        double r329242 = r329231 * r329231;
        double r329243 = 0.225;
        double r329244 = r329242 * r329243;
        double r329245 = 0.5;
        double r329246 = r329244 - r329245;
        double r329247 = r329242 * r329242;
        double r329248 = 0.009642857142857142;
        double r329249 = r329247 * r329248;
        double r329250 = r329246 - r329249;
        double r329251 = r329241 ? r329250 : r329239;
        double r329252 = r329233 ? r329239 : r329251;
        return r329252;
}

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.028213729881585915 or 0.031240215431948184 < x

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied div-sub0.1

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

    if -0.028213729881585915 < x < 0.031240215431948184

    1. Initial program 62.8

      \[\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(\left(x \cdot x\right) \cdot \frac{9}{40} - \frac{1}{2}\right) - \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \frac{27}{2800}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.0

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

Reproduce

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